SRC = $(wildcard *.s)
OBJ = $(SRC:%.s=%.o) 
BIN = $(OBJ:%.o=%)

AS = as
CC = ld

LDFLAGS = -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -lc
ASFLAGS = --32

clean : 
	rm $(OBJ)
cleanall : 
	rm $(BIN) $(OBJ)
paritytest.o : paritytest.s
	$(AS) $(ASFLAGS) -o $@ $<
loop.o : loop.s
betterloop.o : betterloop.s
jumptest.o : jumptest.s
signtest.o : signtest.s
calltest.o : calltest.s
cmptest.o : cmptest.s

paritytest : paritytest.o
	$(CC) $(LDFLAGS) -o $@ $<
loop : loop.o
betterloop : betterloop.o
jumptest : jumptest.o
signtest : signtest.o
calltest : calltest.o
cmptest : cmptest.o
all : paritytest loop  betterloop jumptest signtest calltest cmptest clean
